home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / CDTools / MUIRexx / demos / MUIRexxDir / muidir.rexx < prev    next >
OS/2 REXX Batch file  |  1997-06-09  |  12KB  |  281 lines

  1. /*
  2.  
  3. Code:       muidir.rexx
  4. Author:     Russell Leighton
  5. Revision:   11 Jan 1996
  6.  
  7. Comments:  This is the main script for a simple directory utility that uses
  8. MUIRexx.  This scripts only function is to create the GUI for the directory
  9. utility.  Once setup the script exits.
  10.  
  11. */
  12.  
  13. options results
  14. arg portname
  15.  
  16. /* Method TAG ID definitions */
  17.  
  18. Application_OpenConfigWindow = 0x804299ba /*    { ULONG MethodID; ULONG flags; }; */
  19.  
  20. /* TAG ID definitions */
  21.  
  22. MUIA_AppMessage =                      0x80421955 /* V5  ..g struct AppMessage * */
  23. MUIA_Dropable =                        0x8042fbce /* V11 isg BOOL              */
  24. Draggable = '0x80420b6e'
  25. Dirlist_RejectIcons = '0x80424808'
  26. List_Format =                     0x80423c0a /* V4  isg STRPTR            */
  27. Listview_DragType = '0x80425cd3'
  28. Listview_MultiSelect = '0x80427e08'
  29. Menuitem_Title = '0x804218be'
  30. Weight = '0x80421d1f'
  31. ShowMe = '0x80429ba8'
  32.  
  33. /* TAG variable definitions */
  34.  
  35. TRUE = 1
  36. FALSE = 0
  37. Listview_DragType_None = 0
  38. Listview_DragType_Immediate = 1
  39. Listview_MultiSelect_Shifted = 2
  40. MUIV_EveryTime = 0x49893131
  41.  
  42. if ~show('l', "rexxsupport.library") then do
  43.     call addlib('rexxsupport.library',0,-30,0)
  44. end
  45.  
  46. if ~show('l', "datatypes.library") then do
  47.     call addlib('datatypes.library',0,-30,0)
  48. end
  49.  
  50. address command 'assign muidir: MUIRexx:demos/MUIRexxDir'
  51.  
  52. call pragma('Directory','muidir:')
  53.  
  54. if portname = '' then do
  55.     portname = 'MUIDIR'
  56.     closecom = '"quit"'
  57. end
  58. else closecom = '"window ID MDIR CLOSE"'
  59.  
  60. address VALUE portname
  61. /*
  62. request TITLE '"About MUIDir"' GADGETS '"OK"' FILE '"muidir:about.txt"'
  63. */
  64. setvar screen '"Workbench"'
  65.  
  66. /* begin window definition.  A command to close the window will be issued
  67. to the port MUIREXX if the user hits the close gadget */
  68.  
  69. window ID MDIR CLOSE
  70. window ID MDIR TITLE '"Directory Utility"' COMMAND closecom PORT portname
  71.     menu LABEL "Project"
  72.         item COMMAND '"request TITLE About GADGETS OK FILE muidir:about.txt"' PORT portname LABEL "About"
  73.         menu LABEL "Settings"
  74.             item COMMAND '"method 'Application_OpenConfigWindow'"' PORT portname LABEL "MUI..."
  75.         endmenu
  76.         item ATTRS Menuitem_Title '-1'
  77.         item COMMAND '"window ID MDIR CLOSE"' PORT portname LABEL "Close"
  78.     endmenu
  79.  
  80.     /* begin a vertical group */
  81.  
  82.     group
  83.  
  84.         /* begin a register group */
  85.  
  86.         group ID REG REGISTER LABELS "Directory,Buffers,Volumes,Mirror"
  87.  
  88.             /* begin a vertical group */
  89.  
  90.             group
  91.                 group ID DIR REGISTER LABELS "1,2"
  92.  
  93.                     /* begin a vertical group */
  94.  
  95.                     group
  96.  
  97.                         /* create a text gadget which if hit will issue
  98.                            the command "muidir:comm DIR [/]" to REXX
  99.                            (i.e. execute a REXX macro). This command changes
  100.                            the current directory to the parent directory */
  101.  
  102.                         text ID TXT1 COMMAND '"muidir:comm 'portname' DIR [/]"' NODE '"TXT"' LABEL 'No Directory'
  103.                         group HORIZ
  104.  
  105.                             /* create a dirlist with 5 fields, no .info
  106.                                display, and which will issue a command if an
  107.                                entry is selected (by double clicking on it) */
  108.  
  109.                             dirlist ID DIR1 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"DIR"' ATTRS Listview_DragType Listview_DragType_Immediate Listview_MultiSelect Listview_MultiSelect_Shifted Dirlist_RejectIcons TRUE List_Format '",,,,"'
  110.                             group ID G1 ATTRS Weight 0 ShowMe FALSE
  111.                                 space
  112.                                 group ID GRP1
  113.                                     space HORIZ 20
  114.                                     button ID IMG1 NODE '"IMG"' ATTRS Draggable TRUE
  115.                                 endgroup
  116.                                 space
  117.                             endgroup
  118.                         endgroup
  119.                         group HORIZ
  120.  
  121.                             /* create a check gadget with weight 0 (it will
  122.                                never get sized even if the window is resized)
  123.                                and which will issue a command to port MUIREXX.
  124.                                If the check is unselected then the "%s" will be
  125.                                replaced by "1" else it will be "0".  This
  126.                                will set the attribute Dirlist_RejectIcons
  127.                                (id 0x80424808) to either true or false. */
  128.  
  129.                             check ID ICN1 ATTRS Weight 0 COMMAND '"dirlist ID DIR1 REREAD ATTRS 'Dirlist_RejectIcons' %s"' PORT portname NODE '"ICN"' LABELS "1,0"
  130.  
  131.                             /* create a string gadget which will issue a
  132.                                command if a string is entered (i.e. the user
  133.                                hits the return) */
  134.  
  135.                             string ID SRC1 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"SRC"'
  136.  
  137.                             check ATTRS Weight 0 COMMAND '"group ID G1 ATTRS 'ShowMe' %s"' PORT portname NODE '"CHK"'
  138.                         endgroup
  139.                     endgroup
  140.                     group   /* begin a vertical group */
  141.  
  142.                         /* create a text gadget which if hit will issue
  143.                            the command "muidir:comm DIR [/]" to REXX
  144.                            (i.e. execute a REXX macro). This command changes
  145.                            the current directory to the parent directory */
  146.  
  147.                         text ID TXT2 COMMAND '"muidir:comm 'portname' DIR [/]"' NODE '"TXT"' LABEL 'No Directory'
  148.                         group HORIZ
  149.  
  150.                             /* create a dirlist with 5 fields, no .info
  151.                                display, and which will issue a command if an
  152.                                entry is selected (by double clicking on it) */
  153.  
  154.                             dirlist ID DIR2 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"DIR"' ATTRS Listview_DragType Listview_DragType_Immediate Listview_MultiSelect Listview_MultiSelect_Shifted Dirlist_RejectIcons TRUE List_Format '",,,,"'
  155.                             group ID G2 ATTRS Weight 0 ShowMe FALSE
  156.                                 space
  157.                                 group ID GRP2
  158.                                     space HORIZ 20
  159.                                     button ID IMG2 NODE '"IMG"' ATTRS Draggable TRUE
  160.                                 endgroup
  161.                                 space
  162.                             endgroup
  163.                         endgroup
  164.                         group HORIZ
  165.  
  166.                             /* create a check gadget with weight 0 (it will
  167.                                never get sized even if the window is resized)
  168.                                and which will issue a command to port MUIREXX.
  169.                                If the check is unselected then the "%s" will be
  170.                                replaced by "1" else it will be "0".  This
  171.                                will set the attribute Dirlist_RejectIcons
  172.                                (id 0x80424808) to either true or false. */
  173.  
  174.                             check ID ICN2 ATTRS Weight 0 COMMAND '"dirlist ID DIR2 REREAD ATTRS 'Dirlist_RejectIcons' %s"' PORT portname NODE '"ICN"' LABELS "1,0"
  175.  
  176.                             /* create a string gadget which will issue a
  177.                                command if a string is entered (i.e. the user
  178.                                hits the return) */
  179.  
  180.                             string ID SRC2 COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"SRC"'
  181.  
  182.                             check ATTRS Weight 0 COMMAND '"group ID G2 ATTRS 'ShowMe' %s"' PORT portname NODE '"CHK"'
  183.                         endgroup
  184.                     endgroup
  185.                 endgroup
  186.                 group FRAME
  187.                     group HORIZ
  188.  
  189.                         /* create a series of buttons (arranged
  190.                            horizontally) which if hit will issue commands
  191.                            to REXX (i.e. execute REXX macros) */
  192.  
  193.                         button COMMAND '"muidir:comm 'portname' COPY"' NODE '"COPY"' LABEL 'Copy'
  194.                         button COMMAND '"muidir:comm 'portname' MOVE"' NODE '"MOVE"' LABEL 'Move'
  195.                         button COMMAND '"muidir:renfile 'portname'"' NODE '"RENAME"' LABEL 'Rename'
  196.                         button COMMAND '"muidir:comm 'portname' DELETE"' NODE '"DELETE"' LABEL 'Delete'
  197.                         button COMMAND '"muidir:protfile 'portname'"' NODE '"PROTECT"' LABEL 'Protect'
  198.                     endgroup
  199.                 endgroup
  200.             endgroup
  201.             group
  202.                 group REGISTER LABELS "Path,Command"
  203.  
  204.                     /* create a list to hold the directory history
  205.                        buffer. If an entry in this list is selected
  206.                        then the command to change the directory will be
  207.                        issued */
  208.  
  209.                     list ID LST COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"LST"'
  210.                     group
  211.  
  212.                         /* create a list to hold the command history
  213.                            buffer. */
  214.  
  215.                         list ID HST NODE '"HST"'
  216.                         group HORIZ
  217.                             button COMMAND '"muidir:comm 'portname' HCLEAR"' NODE '"HCLEAR"' LABEL 'Clear'
  218.                             button COMMAND '"list ID HST TOGGLE"' PORT portname NODE '"TOGGLE"' LABEL 'Toggle'
  219.                             button COMMAND '"muidir:comm 'portname' HEXE"' NODE '"HEXE"' LABEL 'Execute'
  220.                         endgroup
  221.                     endgroup
  222.                 endgroup
  223.             endgroup
  224.             group
  225.  
  226.                 /* create a volumelist.  If an entry in this list
  227.                    is selected then the command to change the
  228.                    directory will be issued */
  229.  
  230.                 volumelist COMMAND '"muidir:comm 'portname' DIR [%s]"' NODE '"VOL"'
  231.             endgroup
  232.             group ID MIRR REGISTER LABELS "Copy,Delete"
  233.                 group
  234.  
  235.                     /* create a list to display files to be copied. */
  236.  
  237.                     list ID CLST NODE '"CLST"' ATTRS Listview_MultiSelect Listview_MultiSelect_Shifted 
  238.                     group HORIZ
  239.  
  240.                         /* create a series of buttons (arranged
  241.                            horizontally) which if hit will issue commands
  242.                            to REXX (i.e. execute REXX macros) */
  243.  
  244.                         button COMMAND '"muidir:comm 'portname' CCOPY"' NODE '"CCOPY"' LABEL 'Compile'
  245.                         button COMMAND '"list ID CLST TOGGLE"' PORT portname NODE '"TOGGLE"' LABEL 'Toggle'
  246.                         button COMMAND '"muidir:comm 'portname' MCOPY"' NODE '"MCOPY"' LABEL 'Copy'
  247.                     endgroup
  248.                 endgroup
  249.                 group
  250.  
  251.                     /* create a list to display files to be deleted. */
  252.  
  253.                     list ID DLST NODE '"DLST"' ATTRS Listview_MultiSelect Listview_MultiSelect_Shifted 
  254.                     group HORIZ
  255.  
  256.                         /* create a series of buttons (arranged
  257.                            horizontally) which if hit will issue commands
  258.                            to REXX (i.e. execute REXX macros) */
  259.  
  260.                         button COMMAND '"muidir:comm 'portname' CDEL"' NODE '"CDEL"' LABEL 'Compile'
  261.                         button COMMAND '"list ID DLST TOGGLE"' PORT portname NODE '"TOGGLE"' LABEL 'Toggle'
  262.                         button COMMAND '"muidir:comm 'portname' MDEL"' NODE '"MDEL"' LABEL 'Delete'
  263.                     endgroup
  264.                 endgroup
  265.             endgroup
  266.         endgroup
  267.     endgroup
  268. endwindow
  269.  
  270. callhook ID DIR1 APP COMMAND '"muidir:comm 'portname' DIR [%s]"'
  271. callhook ID DIR2 APP COMMAND '"muidir:comm 'portname' DIR [%s]"'
  272. callhook ID G1 DROP COMMAND '"muidir:comm 'portname' ICON [%s]"'
  273. callhook ID G2 DROP COMMAND '"muidir:comm 'portname' ICON [%s]"'
  274. group ID GRP1 ATTRS MUIA_Dropable FALSE
  275. group ID GRP2 ATTRS MUIA_Dropable FALSE
  276. call 'muidir:comm' portname 'DIR [home:]'
  277.  
  278. /* all finished */
  279.  
  280. exit
  281.